package com.jesper.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jesper.mapper.ConfigMapper;
import com.jesper.model.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConfigService extends ServiceImpl<ConfigMapper, Config> {
    @Autowired
    ConfigMapper configMapper;

    public List<Config> configList() {
        QueryWrapper<Config> configWrapper = new QueryWrapper<>();
        return baseMapper.selectList(configWrapper);
    }

    public Page<Config> query(int page, int pageSize, Config config) {
        QueryWrapper<Config> wrapper = new QueryWrapper<>();
        Page mpage = new Page<>(page, pageSize);
        return this.baseMapper.selectPage(mpage, wrapper);
    }

}
